package com.example.thirdstage_project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.thirdstage_project.dao.ExpertDao;
import com.example.thirdstage_project.entity.Expert;
import com.example.thirdstage_project.entity.User;
import com.example.thirdstage_project.service.ExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 专家信息表(Expert)表服务实现类
 *
 * @author makejava
 * @since 2022-11-24 15:19:04
 */
@Service
public class ExpertServiceImpl extends ServiceImpl<ExpertDao, Expert> implements ExpertService {
    @Autowired
    private ExpertDao expertDao;

    @Override
    public List<Expert> selectAll() {
        return expertDao.selectAll();
    }

    @Override
    public int selectid(int uid) {
        return expertDao.selectid(uid);
    }

    @Override
    public boolean update(Expert expert) {
        return expertDao.update(expert)>0;
    }

    @Override
    public boolean delete(Integer expertid) {
        return expertDao.delete(expertid)>0;
    }

    @Override
    public IPage<User> getPage(int currentPage, int pageSize) {
        IPage page = new Page(currentPage,pageSize);
        expertDao.selectPage(page,null);
        return page;
    }

    @Override
    public int selectuid(int uid) {
        return  expertDao.select(uid);
    }

    @Override
    public boolean updatePassword(String password,int uid) {
        return  expertDao.updatePassword(password,uid)>0;
    }
}

